package com.leet.twopoint;

import java.util.Arrays;

public class Sum {
    public int[] twoSum(int[] numbers, int target) {
        int i = 0, j = numbers.length-1;
        int[] twoSum = new int[2];
        while(i < j){
            if(numbers[i]+numbers[j] == target){
                twoSum[0]=i+1;
                twoSum[1]=j+1;
                return twoSum;
            }else if(numbers[i]+numbers[j]<target){
                i++;
            }else j--;
        }
        return twoSum;
    }
}
